<%@page pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%String baseUrl = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/"; %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.messager.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/bootstrap.min.js"></script>
<head>
<jsp:include page="../admin_head.jsp">
	<jsp:param value="用户信息" name="title" />
</jsp:include>
</head>
<body>
	<div class="container-fluid">
		<div class="row" >
			<div class="col-md-2"></div>
			<div class="col-md-8">
			<div class="panel panel-success" align="center">
				<div class="panel-heading">
				<h1 >课堂教学质量评价系统</h1><br/>当前用户:${user.nickName }&nbsp;&nbsp;&nbsp;
						当前用户角色：${user.userRole }
				&nbsp;&nbsp;&nbsp;&nbsp;<a href="userlist.action?userId=${user.id }"><button class="btn btn-sm btn-success">首页</button></a>
						<a href="${pageContext.request.contextPath }/user/user.action"> <button class="btn btn-sm btn-danger" > <B> 退出登录 </B> </button> </a></div>
				</div>
			
			<jsp:include page="../user/admin_nav.jsp">
					<jsp:param value="用户界面" name="title" />
				</jsp:include>
				<div class="panel panel-success">
				<div class="panel panel-primary" style="margin-top:15px;margin-left: 300px;width:900px">
					<div class="panel-heading">
						<h3 class="panel-title" >课程列表</h3>
					</div>
					<div class="panel-body">
						<table class="table table-hover table-bordered" style="margin-top: 20px" id="user_table">
							<thead>
								<tr align="center" style="font-weight: bold">
									<td>序号</td>
									<td>课程名称</td>
									<td>课程简介</td>
									<td>总课程数</td>
									<td>错误提示</td>
								</tr>
							</thead>
							<tbody>
								<c:if test="${classList ne null}">
								<c:forEach items="${classList}" var="classvo" varStatus="vs">
 										<tr align="center">
											<td>${vs.count }</td>
											<td>${classvo.name }</td>
											<td>${classvo.class_introduce }</td>
											<td>${classvo.class_sum }</td>
											<td>
											<c:if test="${classvo.errorTips eq null}">无 </c:if>
											<span class="red">${classvo.errorTips }</span>
											</td>
										</tr>
								</c:forEach>
								</c:if>
							<tr>
							<td colspan="5">
							<c:if test="${isSubmit eq true }">
							<button class="btn btn-info" onClick="submit()">提交 </button>
							</c:if>
							<c:if test="${isSubmit eq false }">
							<button class="btn btn-default" disabled="disabled">上传文件有错误，无法提交 </button>
							</c:if>
							<button class="btn btn-default" onClick="javascript:history.back()">返回 </button>
							</td>
							</tr>
							</tbody>
						</table>
					</div>
				</div>
			</div>
			</div>
			<div class="col-md-2"></div>
		</div>
	</div>
	<form action="uploadClass.action" method="post" id="uploadForm">
	<input type="hidden" name="userId" value="${user.id }"/>
	<c:if test="${classList ne null}">
		<c:forEach items="${classList}" var="classvo" varStatus="vs">
		<!-- 隐藏域start -->
		<input name="classList[${vs.index }].name" value="${classvo.name }" type="hidden"></input>
		<input name="classList[${vs.index }].class_introduce" value="${classvo.class_introduce }" type="hidden"></input>
		<input name="classList[${vs.index }].class_sum" value="${classvo.class_sum }" type="hidden"></input>
		<!-- 隐藏域end -->
	</c:forEach>
	</c:if>
	<button style="display:none" id="upbtn" type="submit"></button>
	</form>
	<script type="text/javascript">
		var baseUrl = "<%=baseUrl%>";
		window.onload = function(){
		}
		//隐藏(隐藏)某个表格（1显示 2隐藏）
		function show(tableName,type){
			if(type == 1){
				document.getElementById(tableName).removeAttribute("style");
			}else{
				document.getElementById(tableName).style.display = "none";
			}
		}
		function submit(){
			document.getElementById("upbtn").click();
		}
		
	</script>
</body>
</html>
